<template>
    <div class="headerWrapper">
        <el-dropdown :hide-on-click="false"  @command="handleCommand">
            <span class="el-dropdown-link">模式</span>
            <template #dropdown>
                <el-dropdown-menu>
                    <el-dropdown-item v-for="(item,i) in props.status" :key="i" :command="i" :disabled="props.statusPaint ===2?true:false">
                        {{item.name}}
                    </el-dropdown-item>
                </el-dropdown-menu>
            </template>
        </el-dropdown>
        <el-dropdown :hide-on-click="false"  @command="handleCommandPaper">
            <span class="el-dropdown-link">图纸</span>
            <template #dropdown>
                <el-dropdown-menu>
                    <el-dropdown-item v-for="(item,i) in drawing" :key="i" :command="i">
                        {{item.name}}
                    </el-dropdown-item>
                </el-dropdown-menu>
            </template>
        </el-dropdown>
<!--        占时未开放-->
<!--        <el-dropdown :hide-on-click="false"  @command="handleCommand">-->
<!--            <span class="el-dropdown-link">窗口</span>-->
<!--            <template #dropdown>-->
<!--                <el-dropdown-menu>-->
<!--                    <el-dropdown-item v-for="(item,i) in boxoperate" :key="i" :command="i">-->
<!--                        {{item.name}}-->
<!--                    </el-dropdown-item>-->
<!--                </el-dropdown-menu>-->
<!--            </template>-->
<!--        </el-dropdown>-->
    </div>
</template>

<script setup>
import { useStore } from "vuex";
import {getCurrentInstance, ref} from "vue";
import {AddAnExam, GetAnExamByExamName, postTest, SelectGrade} from "../api/ajax/index.js";
import {ElMessage} from "element-plus";
let ws = getCurrentInstance().proxy.$ws;
const store = useStore();
// import bus from 'vue3-eventbus'
//控制模式
const props = defineProps({
    status: Array,
    statusPaint:Number
})
const emit = defineEmits(['change','changePaper','changeInterLock'])
//传回给父组件的函数
const handleCommand = (command) => {
    switch (command) {
        case 0:
            emit('change',command)
            break;
        case 1:
            emit('change',command)
            break;
        case 2:
            emit('change',command)
            break;
        default:
            console.log(`Sorry, we are out of.`);
    }
}

//切换图纸
let drawing = ref([{
    name:'紧停图',
},{
    name:'道岔图'
},{
    name:'联锁图'
}])
//操作打开各种面板
let boxoperate = ref([{
    name:'操作历史'
},{
    name:'速度排行榜'
},{
    name:'分数排行榜'
}])

//切换图纸
const handleCommandPaper = (command) => {
    switch (command) {
        case 0:
            emit('changePaper',command)
            break;
        case 1:
            emit('changePaper',command)
            break;
        case 2:
            emit('changePaper',command)
            break;
        default:
            console.log(`Sorry, we are out of.`);
    }
}
</script>

<style scoped lang="scss">
.headerWrapper{
    display: inline-block;
    width: 60%;
    .el-dropdown-link {
        margin: 0 10px;
        font-size: 17px;
        cursor: pointer;
        color:#ffffff;
        text-decoration:underline
    }
}
</style>
